<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>五一开宝箱 假期游玩新方向</title>
    <script src="{$oss}/active/newyear/js/rem.js"></script>
    <link rel="stylesheet" href="https://oss.goddessxzns.com/active/worksday2021/css/style.css?v=3">
</head>
<body>
<div class="container">
    <div class="header"></div>
    <div class="body">
        <div class="item">
            <div class="box get-coupon{if $is_receive} btn-wait{/if}"></div>
            <div class="btn get-coupon{if $is_receive} btn-wait{/if}"></div>
        </div>
        <div class="item">
            <a href="{$host}/fortune_for_month?time=2021-5&need_auth=1" class="btn" target="_blank"></a>
        </div>
        <div class="item">
            <a href="{$host}/acg_map?need_auth=1" class="btn" target="_blank"></a>
        </div>
        <div class="item">
            <a href="{$host}/fortune_for_year?time=2021&need_auth=1" class="btn" target="_blank"></a>
        </div>
        <div class="item">
            <a href="{$host}/report_index?need_auth=1" class="btn" target="_blank"></a>
        </div>
        <div class="item">
            <a href="{$host}/synastry_report_list?srid=1&need_auth=1" class="btn" target="_blank"></a>
        </div>
    </div>
    <div class="footer"></div>
    <div class="shadow"></div>
    <div class="tips">
        <div class="coupon-detail type0">
            <div class="coupon-name">XXXX优惠券</div>
            <div class="coupon-tip">有效期限30天</div>
        </div>

        <a class="btn" href="javascript:void(0);" target="_blank"></a>
        <div class="close"></div>
    </div>
</div>
<script src="{$oss}active/seven/js/jquery-v2.1.1.min.js"></script>
<script>
    const host = '{$host}';
    const linkList = [
        '/day?need_auth=1',
        '/fortune_for_month?time=2021-5&need_auth=1',
        '/fortune_for_year?time=2021&need_auth=1',
        '/synastry_report_list?srid=1&need_auth=1',
        '/report_index?need_auth=1',
        '/acg_map?need_auth=1',
        '/rectification?need_auth=1',
    ];
    var isGetting = {$is_receive};
    // var isGetting = 0;
    // 关闭提示窗口
    $('.close').click(function () {
        $('.tips').hide();
        $('.shadow').hide();
    })
    // 领取优惠券
    $('.get-coupon').click(function () {
        if ($(this).hasClass('btn-wait')) {
            return false;
        }
        if (isGetting === 0) {
            isGetting = 1;
            $.ajax({
                url: '{url("worksday2021")}',
                type: 'POST',
                dataType: 'json',
                headers: {$headers},
                success: function (res) {
                    if (res.code === 200) {
                        $('.tips .coupon-name').text(res.data.goods_name + '优惠券');
                        $('.coupon-detail').attr('class', 'coupon-detail type' + res.data.coupon_discount)
                        $('.tips .btn').attr('href', host + linkList[res.data.coupon_type])
                        $('.tips').show();
                        $('.shadow').show();
                        // 使按钮变为不可点击状态
                        $('.get-coupon').addClass('btn-wait');
                    }
                },
                error: function (err) {
                    console.log(err)
                }
            })
        }
        return false;
    })
</script>
</body>
</html>
